### function

function StringStartWith()
{
    if [ $# -ne 2 ]; then
        throw_exception_with_file_and_line
        exit 1
    fi

    echo "${1}" | grep -iE "^${2}"
    return $?
}

# AbsoluteDir
#
# $1:       input dir
# #ret:     none
# $echo:    output absolute dir
#
function AbsoluteDir()
{
    if [ $# -ne 1 ]; then
        throw_exception_with_file_and_line
        exit 1
    fi

    old_dir=$(pwd)
    cd ${1}
    echo $(pwd)
    cd ${old_dir}
}

function ScriptDir()
{
    if [ $# -ne 1 ]; then
        throw_exception_with_file_and_line
        exit 1
    fi

    echo `AbsoluteDir ${0%/*}`
}


###
CLANG_BIN_DIR="/x/_build_tools/llvm/llvm-project-16.0.4.src/ci-llvm-project-16.0.4.src/_deploy/x64d/bin";

SCRIPT_DIR=$(ScriptDir "$0")
SCRIPT_DIR_NAME=${SCRIPT_DIR##/*/}
PARENT_DIR="${SCRIPT_DIR%/*}"
BUILD_DIR="${PARENT_DIR}/${SCRIPT_DIR_NAME}-ci/clang/_build/x64d"

echo "SCRIPT_DIR:       ${SCRIPT_DIR}"
echo "SCRIPT_DIR_NAME:  ${SCRIPT_DIR_NAME}"
echo "PARENT_DIR:       ${PARENT_DIR}"
echo "BUILD_DIR:        ${BUILD_DIR}"


mkdir -p ${BUILD_DIR}; \
cd ${BUILD_DIR}; \
"${CLANG_BIN_DIR}/clang.exe" \
-v \
-g \
-O0 \
-I ${SCRIPT_DIR}/include \
-o jc_first_fuzz_sample.exe \
${SCRIPT_DIR}/src/main.cpp \
${SCRIPT_DIR}/src/impl.cpp \
${SCRIPT_DIR}/src/bingo.cpp \
${SCRIPT_DIR}/src/constant.cpp

echo ""
pwd
ls

echo ""
echo "1234" > 1234.txt
./jc_first_fuzz_sample.exe ./1234.txt
